package com.hontech.bv.utils;

public final class SyncBox<T> {

    private T value = null;

    public synchronized void put(T v) {
        value = v;
        notify();
    }

    public void reset() {
        value = null;
    }

    public synchronized T get(long timeout) throws InterruptedException {
        if (value == null) {
            wait(timeout);
        }
        T v = value;
        value = null;
        return v;
    }
}


